<@cms_user><#if !user??>
<div id="login" class="block_popup">
	<div class="popup">
		<a href="#" class="close">Close</a>
		<div class="content">
			<div class="title">
				<p>进入网站</p>
			</div>
			<div class="form">
				<div class="column">
					<p class="label">用户名</p>
					<div class="field">
						<input type="text" name="code" size="30" maxlength="16" value="" autocomplete="off"/>
					</div>
				</div>
				<div class="column">
					<p class="label">密码</p>
					<div class="field">
						<input type="password" name="password" size="30" maxlength="80" value="" autocomplete="off">
					</div>
				</div>
				<div class="column_2">
					<div class="remember">
						<div class="checkbox">
							<input type="checkbox" />
						</div>
						<div class="remember_label">
							<p>记住</p>
						</div>
					</div>
				</div>
				<div class="column_2">
					<p class="forgot_pass">
						<a href="#">忘记密码?</a>
					</p>
				</div>
				<div class="column button">
					<a href="javascript:void(0);" class="enter" onclick="login();"><span>登录</span></a>
				</div>
				<div class="clearboth"></div>
			</div>
			<div class="subtitle">
				<p>SIGN IN AS A USER</p>
			</div>
			<div>
				<a href="${qqLoginUrl}"><img src="${basePath}/res/login/qq.png" /></a>
			</div>
			<div class="text">
				<p>您可以使用第三方帐号登录</p>
			</div>
		</div>
	</div>
</div>
<div id="overlay"></div>
<script src="http://cdn.bootcss.com/jquery/2.1.3/jquery.js"></script>
<script>
	$(function() {
		$('.open_popup').click(function(e) {
			var target = $(this).attr('href');
			$('#overlay').show();
			$(target).show(500);

			e.preventDefault();
		});

		$('.block_popup .close').click(function(e) {
			var target = $(this).attr('href');
			$('.block_popup').hide(500, function() {
				$('#overlay').hide();
			});

			e.preventDefault();
		});
		
		$("#login").keydown(function(event) {
             if (event.keyCode == "13") {//keyCode=13是回车键
            	 login();
             }
        });
	})
	function login(){
		var code = $("[name='code']").val();
		var password = $("[name='password']").val();
		jQuery.ajax({
			url : "${basePath}/login",
			data:{code:code,password:password},
			type : "POST",
			dataType : "json",
			success : function(json){
				if(json.flag){
					window.location.href = window.location.href;
				}else{
					alert(json.msg);
				}
			}
		});
	}
</script>
</#if></@cms_user>
